package umg.os.process;

import java.nio.file.Path;
import java.util.Random;

public class Operation {

	public enum OperationType {
		CPU,
		DEV,
		MEM;

		@Override
		public String toString() {
			switch (this) {
			case CPU:
				return "CPU Access";
			case DEV:
				return "Device Access";
			default:
				return "Unknown";
			}
		}
	}
	
	public enum OperationCommand {
		READ,
		WRITE;

		@Override
		public String toString() {
			switch (this) {
			case READ:
				return "Reading Disk";
			case WRITE:
				return "Writing Disk";
			default:
				return "Unknown";
			}
		}
	}

	public OperationType type;
	public OperationCommand command;
	Path path= null; 
	
	final long duration;
	long initialAddres=0, finalAdress = 0;
	String contentToWrite = null,device = null;	
	public final String description; 

	Operation(OperationType type, long duration, String description) {
		this.type = type;
		this.duration = duration;
		this.description = description;
	}
	
	Operation(OperationType type, long duration) {
		this(type, duration, null);
	}
	
	Operation(OperationType type,String device,OperationCommand command,Path path,String contentToWrite,long initialAddress,long finalAddress)
	{
		this.description="An operation with the Hard Drive Disk";
		this.type = type;
		this.device = device;
		this.command = command;
		this.path = path;
		this.contentToWrite = contentToWrite;
		this.initialAddres = initialAddress;
		this.finalAdress = finalAddress;
		this.duration = new Random().nextInt(5);
	}
	
	@Override
	public String toString() {
		return "Operation Tipe: "+type+"\nDuration: "+duration+"\nDescription: "+description;
	}

}